# 示例：csv_loader.py
from langchain_community.document_loaders.csv_loader import CSVLoader

# 加载csv文档
csv_file_path = ("./llm_langchain_data/doc_search.csv")
loader = CSVLoader(
    file_path=csv_file_path,
    encoding="UTF-8",
    csv_args={
        "delimiter": ",",
        "quotechar": '"',
        "fieldnames": ["Name", "Species", "Age", "Habitat"],
    },
)
data = loader.load()
for record in data[:2]:
    print(record)